#!/bin/python
import requests
from time import time

url="http://127.0.0.1:5000"

# 下载
downloadUrl=url+"/download"

start_time=time()
resp=requests.get(downloadUrl)
end_time=time()

print("Download status:{} size:{} data:{}".format(resp.ok,len(resp.text),resp.text))
print("Time: {:.2f}s".format(end_time - start_time))

# 上传
uploadUrl=url+"/upload"
data=""
for i in range(1000):
    data=data+"\111"

start_time=time()
resp=requests.post(uploadUrl,data=data)
end_time=time()

print("Upload status:{} resp:{}".format(resp.ok,resp.text))
print("Time: {:.2f}s".format(end_time - start_time))
